<template>
  <!-- 单元格   -->
  <van-cell-group class="article-item">
    <!-- 也可以这样跳转 vue Router 允许， 也可以直接拼接字符串 + 动态id :to="`/article/${article.art_id}`"" -->
    <van-cell :to="{ name: '/article', params: { articleId: article.art_id } }">
      <!-- title -->
      <div slot="title" class="title">
        {{ article.title }}
      </div>
      <!-- /title -->

      <!-- 信息 -->
      <div slot="label" class="xinxi">
        <div v-if="article.cover.type === 3">
          <van-image
            v-for="(item, index) in article.cover.images"
            :key="index"
            fit="cover"
            :src="item"
          />
        </div>
        <span>{{ article.aut_name }}</span>
        <span>{{ article.comm_count }}评论</span>
        <span>{{ article.pubdate | dataXiangdui }}</span>
      </div>
      <!-- /信息 -->

      <!-- 3张图片 -->

      <!-- 右侧1张图片 -->
      <van-image
        v-if="article.cover.type === 1"
        slot="extra"
        fit="cover"
        :src="article.cover.images[0]"
        class="one-img"
      />
      <!-- /右侧图片 -->
    </van-cell>
  </van-cell-group>
</template>

<script>
export default {
  data() {
    return {};
  },
  props: {
    article: {
      type: Object,
      require: true,
    },
  },
};
</script>

<style lang="less" scoped>
.article-item {
  .title {
    font-size: 32px;
    color: #3a3a3a;
    margin-bottom: 30px;
  }
  .xinxi {
    span {
      color: #b4b4b4;
      font-size: 23px;
      padding: 0 10px;
    }
    div {
      height: 145px;
      display: flex;
      justify-content: space-between;
      margin-bottom: 30px;
    }
    .van-image {
      vertical-align: top;
      width: 223px;
      height: 100%;
    }
  }
  .one-img {
    width: 233px;
    height: 153px;
    margin-left: 20px;
  }
}
</style>